import request from "../../http";


import { productData } from '@/types/index'
export const defaultProductData:productData = {
  id: 0,
  serverName: '',
  price: null,
  categoryId: null,
  sales: null,
  approvalStatus: ''
}
const serviceApi = {
  async getServiceData(query:any) {
    return request({
      url: "/api/server/list",
      method: "get",
      params: query
    });
  },
  async getServiceDetail(id) {
    return request({
      url: `/api/server/${id}`,
      method: "get"
    });
  },
  async queryServiceData(query:any) {
    return request({
      url: "/api/server/list",
      method: "get",
      params: query
    });
  },
  async getCategoryData(id) {
    return request({
      url: `/api/category/${id}`,
      method: "get"
    });
  },
  async getAllCategoryData() {
    return request({
      url: `/api/category`,
      method: "get"
    });
  },
  async postServiceData(params:any) {
    return request({
      url: "/api/server",
      method: "post",
      data: params
    });
  },
  async delServiceData(id) {
    return request({
      url: `/api/server/${id}`,
      method: "delete"
    });
  },
  // async delServiceData(id) {
  //   return request({
  //     url: `/api/server/${id}`,
  //     method: "delete"
  //   });
  // },
  async delServiceDatas(ids) {
    return request({
      url: "/api/server",
      method: "delete",
      data: ids
    });
  },
  async editServiceData(params:any) {
    return request({
      url: "/api/server",
      method: "post",
      data: params
    });
  },
  async releaseServiceData(ids) {
    return request({
      url: "/api/server/release",
      method: "post",
      data: ids
    });
  },
  async shelvesServiceData(ids) {
    return request({
      url: "/api/server/shelves",
      method: "post",
      data: ids
    });
  },
  async approvalService(params:any) {
    return request({
      url: "/api/server/approval",
      method: "post",
      data: params
    });
  }
};
export default serviceApi;
